<%@page import="com.bf.entity.Res"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'tree.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="admin/resource/css/wzgl.css" />
	<link rel="stylesheet" type="text/css" href="admin/resource/css/global.css" />
    <link rel="stylesheet" type="text/css" href="admin/resource/css/dtree.css" />
    <script src="admin/resource/js/dtree.js" type="text/javascript"></script>

  </head>
  
  <body>
    <div class="nr_left_all">
	<div class="nr_left_title fl">
    	<label>部门信息</label>
    	<a title="刷新" href="javascript:void(window.location.reload());"><div class="flish"></div></a>
    </div>
    <div class="nr_left_tree fl">
      <script type="text/javascript">
		d = new dTree('d');
		d.add(0,-1,'资源管理','res/res_index.action','tree','list');
		<%
		  List<Res> resList = (List<Res>)request.getAttribute("resList");
		  for(Res res : resList) {
		    //显示父部门
		    if(res.getParent()==null) {
		      %>
		       d.add(<%=res.getId()%>,0,'<%=res.getName()%>','res/res_index.action?pid=<%=res.getId()%>','utree','list');
		      <%
		    } else {
		      %>
		      d.add(<%=res.getId()%>,<%=res.getParent().getId()%>,'<%=res.getName()%>','res/res_index.action?pid=<%=res.getId()%>','utree','list');
		      <%
		    }
		    //显示子部门
		  }
		%>
		document.write(d);
	 </script>
    </div>
</div> 
  </body>
</html>
